/* 

Replication files for:
"Evaluating the Effect of Descriptive Norms on Political Tolerance"
By Fabian G. Neuner and Mark D. Ramirez
Published in American Politics Research

*/

*******************************************************************************
*****************************    Study 4   ************************************
*******************************************************************************

* Set scheme for figures

set scheme plotplain

* Load data

use "Study4_data.dta"
	des, short

********************** Study 4 Variables & Recodes ***********************

* Treatment condition 

gen condition =. 
replace condition = 0 if  fl_109_do_controlblock==1
replace condition = 1 if fl_109_do_partisangrouptolerantu==1
replace condition = 2 if fl_109_do_partisangroupintoleran==1
replace condition = 3 if fl_109_do_partisantolerantpartic==1
replace condition = 4 if fl_109_do_partisanintolerantpart==1
replace condition = 5 if fl_109_do_universalistictolerant ==1
replace condition = 6 if fl_109_do_universalisticintolera==1
replace condition = 7 if fl_109_do_particularistictoleran ==1
replace condition = 8 if fl_109_do_particularisticintoler==1

label define conditionlab 0 "control" 1 "Group Tolerant Universalistic" 2 "Group Intolerant Universalistic" 3 "Group Tolerant Particularistic" 4 "Group Intolerant Particularistic" 5 "Tolerant Universalistic" 6 "Intolerant Universalistic" 7 "Tolerant Particularistic" 8 "Intolerant Particularistic"
label value condition conditionlab

recode condition (0=0 "Control") (1/4=1 "Group") (5/8 = 2 "No Group"), gen(condition_groups)
recode condition (0=0 "Control") (1 5 = 1 "Universalistic Tolerant") (2 6 = 2 "Universalistic Intolerant") (3 7 = 3 "Particularistic Tolerant") (4 8 = 4 "Particularistic Intolerant"), gen(condition_vignettes)


* Create Outcome Variables

* Control
recode q69_1 2=5 3=4 4=3 5=2 6=1, gen(control_teach)
recode q69_2 2=5 3=4 4=3 5=2 6=1, gen(control_rally)
recode q69_3 2=5 3=4 4=3 5=2 6=1, gen(control_run)

alpha control_teach control_rally control_run, gen(control) detail
sum control

* Partisan group/tolerant/universalistic 
recode q72_1 8=5 9=4 10=3 11=2 12=1, gen(group_tol_un_teach)
recode q72_2 8=5 9=4 10=3 11=2 12=1, gen(group_tol_un_rally)
recode q72_3 8=5 9=4 10=3 11=2 12=1, gen(group_tol_un_run)

alpha group_tol_un_teach group_tol_un_rally group_tol_un_run, gen(group_tol_un) detail
sum group_tol_un

* Partisan group/intolerant/universalistic 
recode q76_1 2=5 3=4 4=3 5=2 6=1, gen(group_intol_un_teach)
recode q76_2 2=5 3=4 4=3 5=2 6=1, gen(group_intol_un_rally)
recode q76_3 2=5 3=4 4=3 5=2 6=1, gen(group_intol_un_run) 

alpha group_intol_un_teach group_intol_un_rally group_intol_un_run, gen(group_intol_un) detail
sum group_intol_un

* Partisan/tolerant/particularistic 
recode q80_1 2=5 3=4 4=3 5=2 6=1, gen(group_tol_par_teach)
recode q80_2 2=5 3=4 4=3 5=2 6=1, gen(group_tol_par_rally)
recode q80_3 2=5 3=4 4=3 5=2 6=1, gen(group_tol_par_run) 

alpha group_tol_par_teach group_tol_par_rally group_tol_par_run, gen(group_tol_par) detail
sum group_tol_par

*Partisan/intolerant/particularlistic
recode q84_1 2=5 3=4 4=3 5=2 6=1, gen(group_intol_par_teach)
recode q84_2 2=5 3=4 4=3 5=2 6=1, gen(group_intol_par_rally)
recode q84_3 2=5 3=4 4=3 5=2 6=1, gen(group_intol_par_run) 

alpha group_intol_par_teach group_intol_par_rally group_intol_par_run, gen(group_intol_par) detail
sum group_intol_par

* Universalistic/tolerant 
recode q87_1 5=1 4=2 3=3 2=4 1=5, gen(tol_un_teach)
recode q87_2 5=1 4=2 3=3 2=4 1=5, gen(tol_un_rally)
recode q87_3 5=1 4=2 3=3 2=4 1=5, gen(tol_un_run)

alpha tol_un_teach tol_un_rally tol_un_run, gen(tol_un) detail
sum tol_un

* Universalistic/intolerant 
recode q90_1 5=1 4=2 3=3 2=4 1=5, gen(intol_un_teach)
recode q90_2 5=1 4=2 3=3 2=4 1=5, gen(intol_un_rally)
recode q90_3 5=1 4=2 3=3 2=4 1=5, gen(intol_un_run)

alpha intol_un_teach intol_un_rally intol_un_run, gen(intol_un) detail
sum intol_un

* Particularistic/tolerant 
recode q93_1 5=1 4=2 3=3 2=4 1=5, gen(tol_par_teach)
recode q93_2 5=1 4=2 3=3 2=4 1=5, gen(tol_par_rally)
recode q93_3 5=1 4=2 3=3 2=4 1=5, gen(tol_par_run)

alpha tol_par_teach tol_par_rally tol_par_run, gen(tol_par) detail
sum tol_par

* particularistic/intolerant
recode q96_1 5=1 4=2 3=3 2=4 1=5, gen(intol_par_teach)
recode q96_2 5=1 4=2 3=3 2=4 1=5, gen(intol_par_rally)
recode q96_3 5=1 4=2 3=3 2=4 1=5, gen(intol_par_run)

alpha intol_par_teach intol_par_rally intol_par_run, gen(intol_par) detail
sum intol_par

egen outcome= rowtotal(control group_tol_un group_intol_un group_tol_par group_intol_par tol_un intol_un tol_par intol_par)
recode outcome 0=.

* Partisanship

gen pid7=.
replace pid7 = 1 if q45==1
replace pid7 = 2 if q45==2
replace pid7 = 3 if q46==2
replace pid7 = 4 if q46==3
replace pid7 = 5 if q46==1
replace pid7 = 6 if q44==2
replace pid7 = 7 if q44==1

recode q43 (2=0 "Democrat") (1=1 "Republican") (else=.), gen(Republican)
replace Republican=1 if q46==1
replace Republican=0 if q46==2


* Rescale 0-1

foreach x in outcome pid7 {
sum `x'
gen `x'01 = (`x'-r(min))/(r(max)-r(min))
}

********************** Study 4 Analysis ***********************

* Table A.9

reg outcome01 i.condition_vignettes
est sto m1

esttab m1 using TableA9.rtf, replace se label nonumber title("Effect of Norms on Tolerance (Study 4)") mtitle("Model 1")  b(%9.2f) star(* 0.10 ** 0.05 ) r2 wide

* Figure 6

coefplot, drop(_cons) xline(0) msymbol(O) levels(95 90) ///
 plotregion(fcolor(white) lcolor(gs10) lwidth(med)) ///
 ylabel(, /// y-axis label #s
labcolor(gs4) tlcolor() tlwidth(thin) labsize(small) nogrid) ///
xlabel( -.05 0 .05 .1 .15 .2, /// x-axis label #s
labcolor(gs4) tlcolor() tlwidth(thin) labsize(small) nogrid) ///
 xtitle("ATE of each Treatment vs. Control", color(black)) ///
 mcolor(black) mlcolor(black)  /// point estimate color options
ciopts(lwidth(*0.75 *1.5) lcolor(black black)) ///
grid(none) //
graph export Figure6.pdf, replace


* Figure A.2

reg outcome01 i.condition
coefplot, drop(_cons) xline(0) msymbol(O) levels(95 90) ///
 plotregion(fcolor(white) lcolor(gs10) lwidth(med)) ///
 ylabel(, /// y-axis label #s
labcolor(gs4) tlcolor() tlwidth(thin) labsize(small) nogrid) ///
xlabel( -.05 0 .05 .1 .15 .2, /// x-axis label #s
labcolor(gs4) tlcolor() tlwidth(thin) labsize(small) nogrid) ///
 xtitle("ATE of each Treatment vs. Control", color(black)) ///
 mcolor(black) mlcolor(black)  /// point estimate color options
ciopts(lwidth(*0.75 *1.5) lcolor(black black)) ///
coeflabels(1.condition = `" "Group Tol"   "Universalistic" "' 2.condition = `" "Group Intol"   "Universalistic" "' 3.condition = `" "Group Tol"   "Particularistic" "' 4.condition = `" "Group Intol"   "Particularistic" "' 5.condition = `" "Tolerant"   "Universalistic" "' 6.condition = `" "Intolerant"   "Universalistic" "' 7.condition = `" "Tolerant"   "Particularistic" "' 8.condition = `" "Intolerant"   "Particularistic" "') ///
grid(none) //
graph export FigureA2.pdf


* Figure A.3

reg outcome01 i.condition_vignettes if Republican==0
estimates store s4_Democrat

reg outcome01 i.condition_vignettes if Republican==1
estimates store s4_Republican

coefplot (s4_Democrat), bylabel(Among Democrats) ///
 plotregion(fcolor(white) lcolor(gs10) lwidth(med)) ///
  ylabel(, /// y-axis label #s
labcolor(gs4) tlcolor() tlwidth(thin) labsize(small) nogrid) ///
xlabel( -.05 0 .05 .1 .15 .2, /// x-axis label #s
labcolor(gs4) tlcolor() tlwidth(thin) labsize(small) nogrid) ///
 xtitle("ATE of each Treatment vs. Control", color(black)) ///
 mcolor(black) mlcolor(black) msymbol(O)  /// point estimate color options
ciopts(lwidth(*0.75 *1.5) lcolor(black black)) ///
|| (s4_Republican), bylabel(Among Republicans) ///
|| , drop(_cons) yline(0) levels(95 90) coeflabels(1.condition_vignettes = `""Tolerant" "Universalistic"""' 2.condition_vignettes = `""Intolerant" "Universalistic"""' 3.condition_vignettes = `""Tolerant" "Particularistic"""' 4.condition_vignettes = `""Intolerant" "Particularistic"""') ///
grid(none) ///
xline(0, lp(dash) lcolor(grey)) //
graph export FigureA3.pdf

